package tw.miku.protocol.codec.gold;

import java.nio.charset.CharacterCodingException;

import org.apache.mina.core.buffer.IoBuffer;

import tw.miku.constants.ProtocalConstants;
import tw.miku.protocol.codec.AbstractResponseMessagePack;

public class SetToolToUserResponsePack extends AbstractResponseMessagePack
{

	public long targetUserId;
	public long sourceUserId;
	public int cardId;

	public SetToolToUserResponsePack()
	{

	}

	@Override
	public short getTag()
	{
		return ProtocalConstants.SET_TOOL_TO_USER;
	}

	@Override
	public IoBuffer encode() throws CharacterCodingException
	{
		IoBuffer buf = IoBuffer.allocate(20);
		buf.putUnsignedInt(16);
		buf.putShort(getTag());
		buf.putShort((short) 0);
		buf.putInt(cardId);
		buf.putUnsignedInt(targetUserId);
		buf.putUnsignedInt(sourceUserId);
		buf.position(0);

		return buf;
	}

}
